#include<bits/stdc++.h>
#define se second
#define fi first
using namespace std;
using pii=pair<int,int>;
using ll=long long;
const int INF=0x3f3f3f3f;
const int P=998244353;
void ckmn(int &x,int y){if(y<x)x=y;}
int n,m;
vector<pii>e;
namespace Sub1{

void solve(){
    int u,v,w,x,y,z;
    cin>>n>>m;e.resize(m);
    for(auto &p:e)cin>>p.fi>>p.se;
    vector<pii>E;
    for(int i=1;i<=n;++i)
        for(int j=i+1;j<=n;++j)
            E.emplace_back(i,j);
    int m=E.size(),S=1<<m,cnt=0;ll ans=-1e18;
    for(int s=0;s<S;++s)if(__builtin_popcount(s)+1==e.size()){
        vector<vector<int>>f(n+1,vector<int>(n+1,INF));
        for(int i=0;i<m;++i)if(s>>i&1)
            f[E[i].fi][E[i].se]=f[E[i].se][E[i].fi]=1;
        for(int k=1;k<=n;++k)
            for(int i=1;i<=n;++i)
                for(int j=1;j<=n;++j)
                    ckmn(f[i][j],f[i][k]+f[k][j]);
        ll res=0;
        for(auto p:e)res-=f[p.fi][p.se];
        if(res>ans)ans=res,cnt=1;
        else if(res==ans)++cnt;
    }
    printf("%lld %d\n",ans,cnt);
}

}
namespace Sub2{

void solve(){
    int u,v,w,x,y,z;
    cin>>n>>m;e.resize(m);
    for(auto &p:e)cin>>p.fi>>p.se;
    printf("%d ",n);puts("");
}

}
int main(){
    freopen("oi.in","r",stdin);
    freopen("oi.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int T,ID;cin>>ID>>T;
    if(ID==1||ID==2)while(T--)Sub1::solve();
    if(ID==3||ID==4)while(T--)Sub2::solve();
    return 0;
}